﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL_Class
{
    public class UIAdvertise
    {
        NLLDataContext db;
        #region "Lay banner top"
        public IEnumerable<Advertise> GetBannerTop()
        {
            db = new NLLDataContext();
            IEnumerable<Advertise> ad = from a in db.Advertises 
                                      where (a.Position == "Banner Top") && (a.IsFrontPage == true)       
                                      select a;
            return ad;
        }
        #endregion

        #region "Lay banner duoi banner top"
        public IEnumerable<Advertise> GetBannerBot()
        {
            db = new NLLDataContext();
            IEnumerable<Advertise> ad = from a in db.Advertises
                                        where (a.Position == "Banner Advertise") && (a.IsFrontPage == true)
                                        select a;
            return ad;
        }
        #endregion

        #region "Lay banner right"
        public IEnumerable<Advertise> GetBannerRight()
        {
            db = new NLLDataContext();
            IEnumerable<Advertise> ad = from a in db.Advertises
                                        where (a.Position == "Banner Right") && (a.IsFrontPage == true)
                                        select a;
            return ad;
        }
        #endregion

        #region "Lay banner left"
        public IEnumerable<Advertise> GetBannerLeft()
        {
            db = new NLLDataContext();
            IEnumerable<Advertise> ad = from a in db.Advertises
                                        where (a.Position == "Banner Left") && (a.IsFrontPage == true)
                                        select a;
            return ad;
        }
        #endregion

        #region "Lay banner doi tac"
        public IEnumerable<Partner> GetBannerPartner()
        {
            db = new NLLDataContext();
            IEnumerable<Partner> ps = from p in db.Partners select p;
            return ps;
        }
        #endregion

        #region "Lay footer"
        public IEnumerable<MyConfig> GetFooter()
        {
            db = new NLLDataContext();
            IEnumerable<MyConfig> cf = from c in db.MyConfigs select c;
            return cf;
        }
        #endregion
    }
}
